﻿using System.Collections.ObjectModel;
using WirelessAccessPoint.Core;

namespace WirelessAccessPoint.Model
{
    /// <summary>
    /// Internet Connection Sharing (ICS)の状態を表します。
    /// </summary>
    public class NetSharingContext : ModelBase
    {
        private NetSharing selectedPublicNetSharing;
        private NetSharing activePublicNetSharing;
        private NetSharing activePrivateNetSharing;
        private ObservableCollection<NetSharing> netSharings;

        /// <summary>
        /// 選択されているPublic側Internet Connection Sharing (ICS)を設定または取得します。
        /// </summary>
        public NetSharing SelectedPublicNetSharing
        {
            get { return this.selectedPublicNetSharing; }
            set
            {
                if (value != this.selectedPublicNetSharing)
                {
                    this.selectedPublicNetSharing = value;
                    this.OnPropertyChanged(() => this.SelectedPublicNetSharing);
                }
            }
        }

        /// <summary>
        /// 開始されているPublic側Internet Connection Sharing (ICS)を設定または取得します。
        /// </summary>
        public NetSharing ActivePublicNetSharing
        {
            get { return this.activePublicNetSharing; }
            set
            {
                if (value != this.activePublicNetSharing)
                {
                    this.activePublicNetSharing = value;
                    this.OnPropertyChanged(() => this.ActivePublicNetSharing);
                }
            }
        }

        /// <summary>
        /// 開始されているPrivate側Internet Connection Sharing (ICS)を設定または取得します。
        /// </summary>
        public NetSharing ActivePrivateNetSharing
        {
            get { return this.activePrivateNetSharing; }
            set
            {
                if (value != this.activePrivateNetSharing)
                {
                    this.activePrivateNetSharing = value;
                    this.OnPropertyChanged(() => this.ActivePrivateNetSharing);
                }
            }
        }

        /// <summary>
        /// Internet Connection Sharing (ICS)の一覧を取得します。
        /// </summary>
        public ObservableCollection<NetSharing> NetSharings
        {
            get
            {
                if (this.netSharings == null)
                {
                    this.netSharings = new ObservableCollection<NetSharing>();
                    this.OnPropertyChanged(() => this.NetSharings);
                }

                return this.netSharings;
            }
        }
    }
}
